package com.dm.controller;

import com.dm.common.Dto;
import com.dm.service.LocalItemService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/item/api")
public class ItemController {
    @Resource
    private LocalItemService localItemService;

    @RequestMapping(value = "/getItemInfo", method = RequestMethod.POST)
    public Dto getItemInfo(@RequestParam("id") String id) throws Exception {
        return localItemService.getItem(Long.valueOf(id));
    }

    @RequestMapping(value = "/getScheduler", method = RequestMethod.POST)
    public Dto getScheduler(String itemId) throws Exception {
        return localItemService.getScheduler(Long.valueOf(itemId));
    }
    @RequestMapping(value = "/getItemPrice",method = RequestMethod.POST)
    public Dto getItemPrice(String schedulerId)throws Exception{
        return localItemService.getItemPrice(Long.valueOf(schedulerId));
    }
    @RequestMapping(value = "queryItemComment",method = RequestMethod.POST)
    public Dto queryItemComment(String id)throws Exception{
        return localItemService.queryItemComment(Long.valueOf(id));
    }
}
